home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 27 / CU Amiga Magazine's Super CD-ROM 27 (1998)(EMAP Images)(GB)[!][issue 1998-10].iso / CUCD / Programming / BlitzList / BlitzListFiles / screenmode.lha / screenmode
Encoding:
Text File  |  1998-07-20  |  3.9 KB  |  125 lines

  1. WBStartup
  2.  
  3. WBenchToFront_
  4.  
  5. NoCli
  6.  
  7. WbToScreen 1                               ;we use WB for mode requester
  8.  
  9. LoadFont 0,"topaz.font",8                  ;load test screen's font
  10. *fn=Addr IntuiFont (0)                     ;pointer to screen font
  11.  
  12.  
  13.  
  14. NEWTYPE.SMode                              ;for the mode requester
  15.   DisplayID.l
  16.   DisplayWidth.l
  17.   DisplayHeight.l
  18.   DisplayDepth.w
  19.   OverscanType.w
  20. End NEWTYPE
  21.  
  22. sm$="Select A Screen Mode:"                ;title for mode requester
  23.  
  24. If NTSC=True                               ;set default screen mode
  25.   imode.l=$19004                           ;NTSC hi-res lace for NTSC
  26.   iheight.w=400
  27. Else
  28.   imode.l=$29004                           ;PAL hi-res laced for PAL
  29.   iheight.w=512
  30. EndIf
  31.  
  32. Dim SMRtags.TagItem(19)                    ;taglist for mode requester
  33.  
  34. SMRtags(0)\ti_Tag=#ASLSM_InitialLeftEdge,160     ;these are the position for the
  35. SMRtags(1)\ti_Tag=#ASLSM_InitialTopEdge,10       ;screenmode requester
  36. SMRtags(2)\ti_Tag=#ASLSM_InitialWidth,320
  37. SMRtags(3)\ti_Tag=#ASLSM_InitialHeight,200
  38. SMRtags(4)\ti_Tag=#ASLSM_InitialDisplayID,imode  ;these are shown as "selected"
  39. SMRtags(5)\ti_Tag=#ASLSM_InitialDisplayDepth,3   ;when the requester opens
  40. SMRtags(6)\ti_Tag=#ASLSM_InitialDisplayWidth,640
  41. SMRtags(7)\ti_Tag=#ASLSM_InitialDisplayHeight,iheight
  42. SMRtags(8)\ti_Tag=#ASLSM_InitialOverscanType,1
  43. SMRtags(9)\ti_Tag=#ASLSM_InitialInfoOpened,0     ;no "properties" window
  44. SMRtags(10)\ti_Tag=#ASLSM_DoDepth,1              ;0 for no depth selector
  45. SMRtags(11)\ti_Tag=#ASLSM_DoOverscanType,1       ;0 for no OverScan selector
  46. SMRtags(12)\ti_Tag=#ASLSM_DoWidth,1              ;0 for no width gadget
  47. SMRtags(13)\ti_Tag=#ASLSM_DoHeight,1             ;0 for no height gadget
  48. SMRtags(14)\ti_Tag=#ASLSM_MinHeight,200          ;minimum height allowed
  49. SMRtags(15)\ti_Tag=#ASLSM_MinWidth,320           ;minimum width allowed
  50. SMRtags(16)\ti_Tag=#ASLSM_MinDepth,3             ;minimum depth allowed
  51. SMRtags(17)\ti_Tag=#ASLSM_TitleText,&sm$         ;pointer to requester title$
  52. SMRtags(18)\ti_Tag=#TAG_DONE
  53.  
  54. ;
  55. ; ScreenMode requester returns the ScreenMode structure
  56. ;
  57.  
  58. *sreq.SMode=0
  59. *sreq=AllocAslRequest_(2,&SMRtags(0)\ti_Tag)
  60. ok.b=AslRequest_(*sreq,&SMRtags(0)\ti_Tag)
  61.  
  62. If ok<>0       ;if 0, the cancel gadget was hit
  63.  
  64.   ;------- read the results into variables
  65.   ;this part is not really necessary, but makes it possible to
  66.   ;just make up the screen without using the requester every time
  67.   ;the program is started
  68.   ;these results could be saved into a "prefs" file
  69.   ;and reloaded into your program before opening the screen
  70.  
  71.   Display.l=*sreq\DisplayID
  72.   Oscan.w=*sreq\OverscanType
  73.   Dpth.w=*sreq\DisplayDepth
  74.   Widh.l=*sreq\DisplayWidth
  75.   Heit.l=*sreq\DisplayHeight
  76.  
  77.   ;------- now make the "Program's" screen --------------------
  78.   ; we will make it up in back and pop to the front when ready
  79.  
  80.  
  81.   Dim SCRtags.TagItem(12)
  82.   SCRtags(0)\ti_Tag=#SA_DisplayID,Display
  83.   SCRtags(1)\ti_Tag=#SA_Overscan,Oscan
  84.   SCRtags(2)\ti_Tag=#SA_Depth,Dpth
  85.   SCRtags(3)\ti_Tag=#SA_Width,Widh
  86.   SCRtags(4)\ti_Tag=#SA_Height,Heit
  87.   SCRtags(5)\ti_Tag=#SA_Top,0
  88.   SCRtags(6)\ti_Tag=#SA_Left,0
  89.   SCRtags(7)\ti_Tag=#SA_AutoScroll,1         ;autoscroll is on!
  90.   SCRtags(8)\ti_Tag=#SA_Pens,?DriPens        ;List of 13 Dripens
  91.   SCRtags(9)\ti_Tag=#SA_Behind,1             ;make screen in back of display
  92.   SCRtags(10)\ti_Tag=#SA_ShowTitle,0
  93.   SCRtags(11)\ti_Tag=#TAG_DONE
  94.  
  95.   ScreenTags 0,"Test Screen",& SCRtags(0)    ;open the test screen
  96.  
  97.   Window 1,10,10,300,100,$1000|$8,"Screen info",1,0  ;and a small window
  98.   NPrint "$"+Hex$(Display)
  99.   NPrint "Depth=",Dpth
  100.   NPrint "Press close gadget to end"
  101.  
  102.   ShowScreen 0                               ;now bring screen to the front
  103.  
  104.  
  105.   Repeat                                     ;just wait until the window
  106.     ev.l=WaitEvent                           ;close gadget is pressed
  107.   Until ev=$200
  108.  
  109.  
  110. Else
  111.   Request "","Cancelled!","OK"
  112.   End
  113. EndIf
  114. If (*sreq) Then FreeAslRequest_(*sreq)       ;we MUST free this ourselves
  115.  
  116.  
  117. End
  118.  
  119. Even
  120. DriPens
  121. Dc.w  0,1,1,2,1,3,1,0,2,1,2,1,-1
  122.  
  123.  
  124.  
  125.